# ICX Switch Script with Posh-SSH #This script uses the credentials user1 and userpassword to SSH into switch 10.0.0.1 #and change the VLAN on port 1/1/13 to VLAN 40. # # Enter user credentials into the script $User = "user1" $PWord = ConvertTo-SecureString -String "userpassword" -AsPlainText -Force $Credential = New-Object -TypeName "System.Management.Automation.PSCredential" -ArgumentList $User, $PWord #Open the SSH session New-SSHSession -ComputerName 10.0.0.1 -Credential ($Credential) -Verbose $SSHStream = New-SSHShellStream -Index 0 #Break to establish session sleep 10 # Write commands to the switch $SSHStream.WriteLine("config t") $SSHStream.WriteLine("vlan 40") $SSHStream.WriteLine("untagged e 1/1/13") sleep 2 # End SSH session Remove-SSHSession -Index 0